package com.gxsyh.nantie.permission.provider.service.impl;

import com.gxsyh.nantie.permission.provider.domain.TbUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.gxsyh.nantie.permission.provider.mapper.TbUserMapper;
import com.gxsyh.nantie.permission.provider.service.TbUserService;
import tk.mybatis.mapper.entity.Example;

/**
 * @email yom535@outlook.com
 * @author: 刘锋嘉(Liu Fengjia)
 * @date: 2020/1/14
 * @time: 17:38
 * @Description: 
 */
@Service
public class TbUserServiceImpl implements TbUserService{

    @Resource
    private TbUserMapper tbUserMapper;

    @Override
    public int updateTbUserSubsidyStatus(Long id, int subsidyStatus) {
        Example example=new Example(TbUser.class);
        example.createCriteria().andEqualTo("id",id);
        TbUser tbUser=new TbUser();
        tbUser.setSubsidyStatus(subsidyStatus);
        return tbUserMapper.updateByExampleSelective(tbUser,example);
    }

    @Override
    public TbUser selectOneUserById(Long userId) {
        Example example=new Example(TbUser.class);
        example.createCriteria().andEqualTo("id",userId);
        return tbUserMapper.selectOneByExample(example);
    }
}
